import request from "../utils/request";

//获取订单信息的接口
export const reqGetTradeInfo = () => {
	return request({
		method: "GET",
		url: "/order/auth/trade"
	});
};

//提交订单的接口
export const reqSubmitOrder = ({
	tradeNo,
	consignee,
	consigneeTel,
	deliveryAddress,
	paymentWay,
	orderComment,
	orderDetailList
}) => {
	return request({
		method: "POST",
		url: "/order/auth/submitOrder",
		params: {
			tradeNo
		},
		data: {
			consignee,
			consigneeTel,
			deliveryAddress,
			paymentWay,
			orderComment,
			orderDetailList
		}
	});
};

//获取订单支付信息
export const reqGetWinXinQrcode = (orderId) => {
	return request({
		method: "GET",
		url: `/payment/weixin/createNative/${orderId}`
	});
};

//查询支付状态
export const reqGetPayStatus = (orderId) => {
	return request({
		method: "GET",
		url: `/payment/weixin/queryPayStatus/${orderId}`
	});
};

//获取订单列表
export const reqGetOrderList = (page, limit) => {
	return request({
		method: "GET",
		url: `/order/auth/${page}/${limit}`
	});
};
